﻿using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using ESRI.ArcGIS.ADF;
using ESRI.ArcGIS.ADF.BaseClasses;
using PlanningGIS.Framework;
namespace PlanningGIS.MetadataEdit
{
  
    public class MeataDataManage : BaseCommand
    {
        /// <summary>
        /// 
        /// </summary>
        IApplication m_Application = null;
        /// <summary>
        /// 
        /// </summary>
        public MeataDataManage()
        {
            base.m_caption = "元数据编辑";
            base.m_name = "MeataDataManage";
            base.m_toolTip = "元数据编辑";
            base.m_message = "元数据编辑";
            base.m_category = "元数据编辑";
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hook"></param>
        public override void OnCreate(object hook)
        {
            if (m_Application == null)
            {
                m_Application = hook as IApplication;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public override void OnClick()
        {
            FrmMetaData frm = new MetadataEdit.FrmMetaData();
            frm.Show((m_Application as IFramework).MdiForm);
        }

        /// <summary>
        /// 图标
        /// </summary>
        public override int Bitmap
        {
            get
            {
                string resourceName = this.GetType().Namespace + ".Res." + this.GetType().Name + ".png";
                return new Bitmap(GetType().Assembly.GetManifestResourceStream(resourceName)).GetHbitmap().ToInt32();
            }
        }

        /// <summary>
        /// 可用状态
        /// </summary>
        public override bool Enabled
        {
            get
            {
                if (m_Application == null) return false; 
                return (m_Application as IFramework).IsMapCtrlactive;
            }
        }
    }
}